Sorting data topic
Sort and reorder lists of values.
Functions
-
ascending(
Object? a, Object? b) → num Sorting data -
Returns -1 if
ais less thanb, or 1 ifais greater thanb, or 0. -
descending(
Object? a, Object? b) → num Sorting data - Returns -1 if a is greater than b, or 1 if a is less than b, or 0.
-
permute<
T> (Iterable< Sorting dataT> iterable, Iterable<int> keys) → List<T?> -
Returns a permutation of the specified
iterableusing thekeys. -
permuteMap<
K, V> (Map< Sorting dataK, V> map, Iterable<K> keys) → List<V?> -
Returns a permutation of the specified
mapusing thekeys. -
quickselect<
T extends List< (E> , E>T elements, num k, {num left = 0, num right = double.infinity, int compare(E, E) = ascendingDefined}) → T Sorting data - See mourner/quickselect.
-
reverse<
T> (Iterable< Sorting dataT> iterable) → List<T> -
Returns an list containing the values in the given
iterablein reverse order. -
shuffle<
T> (List< Sorting dataT> list, [int start = 0, int? stop]) → List<T> -
Randomizes the order of the specified
listin-place using the Fisher–Yates shuffle and returns thelist. -
shuffler<
T> (num random()) → List< Sorting dataT> Function(List<T> , [int, int?]) -
Returns a shuffle function given the specified
randomsource. For example, using randomLcg: -
sort<
T> (Iterable< Sorting dataT> iterable, [num comparator(T, T) = ascending]) → List<T> -
Returns an list containing the values in the given
iterablein the sorted order defined by the givencomparator. -
sortBy<
T, R> (Iterable< Sorting dataT> iterable, R accessor(T), [num comparator(R, R) = ascending]) → List<T> -
Returns a list containing the elements of the given
iterablein the sorted order defined by the values yielded by the givenaccessorfunction.